<template>
    <view class="x-center x-normal-top">加载中...</view>
</template>

<script setup name="start">
import {Http, Cache} from 'core';
import userStore from '@/stores/framework/user';
const UserStore = userStore();

onLoad(async (option) => {
  start();
})

const start = async () => {
  let {code, data} = await UserStore.check();
  if(code == 200) {
    let user = data.sysUser;
    let roles = data.roles;
    let permissions = data.permissions;
    UserStore.setUser(user, roles, permissions);
    uni.switchTab({
    	url: "/pages/index"
    })
  } else {
    uni.redirectTo({
    	url: "/pages/login"
    })
  }
}

</script>

<style scoped lang="less">

</style>
